home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / t2win-32 / _registr.frm (.txt) < prev    next >
Visual Basic Form  |  1998-07-13  |  15KB  |  272 lines

  1. VERSION 5.00
  2. Begin VB.Form frmRegistry 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Registry"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4845
  13.    ScaleWidth      =   7485
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Frame Frame1 
  16.       Height          =   570
  17.       Left            =   0
  18.       TabIndex        =   1
  19.       Top             =   -90
  20.       Width           =   7485
  21.       Begin VB.CommandButton cmdNP 
  22.          Caption         =   ">"
  23.          Height          =   285
  24.          Index           =   1
  25.          Left            =   7110
  26.          TabIndex        =   6
  27.          Top             =   195
  28.          Width           =   285
  29.       End
  30.       Begin VB.CommandButton cmdNP 
  31.          Caption         =   "<"
  32.          Height          =   285
  33.          Index           =   0
  34.          Left            =   6210
  35.          TabIndex        =   5
  36.          Top             =   195
  37.          Width           =   285
  38.       End
  39.       Begin VB.CommandButton Command1 
  40.          Caption         =   "&Go"
  41.          Default         =   -1  'True
  42.          Height          =   285
  43.          Left            =   6570
  44.          TabIndex        =   4
  45.          Top             =   195
  46.          Width           =   465
  47.       End
  48.       Begin VB.ComboBox cmb_Function 
  49.          Height          =   315
  50.          Left            =   1365
  51.          TabIndex        =   2
  52.          Top             =   180
  53.          Width           =   4755
  54.       End
  55.       Begin VB.Label Label2 
  56.          Caption         =   "&Select a function"
  57.          Height          =   255
  58.          Left            =   90
  59.          TabIndex        =   3
  60.          Top             =   210
  61.          Width           =   1275
  62.       End
  63.    End
  64.    Begin VB.TextBox txt_Result 
  65.       BackColor       =   &H00C0C0C0&
  66.       BorderStyle     =   0  'None
  67.       Height          =   4110
  68.       Left            =   105
  69.       Locked          =   -1  'True
  70.       MultiLine       =   -1  'True
  71.       ScrollBars      =   2  'Vertical
  72.       TabIndex        =   0
  73.       Top             =   630
  74.       Width           =   7260
  75.    End
  76. Attribute VB_Name = "frmRegistry"
  77. Attribute VB_GlobalNameSpace = False
  78. Attribute VB_Creatable = False
  79. Attribute VB_PredeclaredId = True
  80. Attribute VB_Exposed = False
  81. Option Explicit
  82. Option Base 1
  83. Private Const Iteration = 250
  84. Dim IsLoaded         As Integer
  85. Dim TimerStartOk     As Integer
  86. Dim TimerCloseOk     As Integer
  87. Dim TimerHandle      As Integer
  88. Dim TimerValue       As Long
  89. Private Sub cmdNP_Click(Index As Integer)
  90.    Call sub_NextPrev(cmb_Function, Index)
  91. End Sub
  92. Private Sub cmb_Function_Click()
  93.    If (IsLoaded = False) Then Exit Sub
  94.    Call cDisableFI(mdiT2W.Picture1)
  95.    txt_Result = ""
  96.    DoEvents
  97.    Select Case cmb_Function.ListIndex
  98.       Case 0
  99.          Call TestRegistry
  100.       Case 1
  101.          Call TestRegistryExt
  102.       Case 2
  103.          Call TestGetAllSettings
  104.    End Select
  105.    DoEvents
  106.    Call cEnableFI(mdiT2W.Picture1)
  107. End Sub
  108. Private Sub Form_Activate()
  109.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  110. End Sub
  111. Private Sub Form_Load()
  112.    IsLoaded = False
  113.    Show
  114.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_registr.t2w")
  115.    IsLoaded = True
  116. End Sub
  117. Private Sub Command1_Click()
  118.    Call cmb_Function_Click
  119. End Sub
  120. Private Sub TestRegistry()
  121.    Dim intResult        As Integer
  122.    Dim strResult        As String
  123.    Dim strDisplay       As String
  124.    Dim Section1         As String
  125.    Dim Section2         As String
  126.    Dim i                As Integer
  127.    Dim RKI              As tagREGISTRYKEYINFO
  128.    strResult = ""
  129.    strDisplay = ""
  130.    strDisplay = strDisplay & "HKEY_CURRENT_USER" & vbCrLf & vbCrLf
  131.    Section1 = "under the fox"
  132.    Section2 = "software\The MCR Company\TIME TO WIN for VB 4.0"
  133.    strDisplay = strDisplay & "Use section '" & Section1 & "'" & vbCrLf & vbCrLf
  134.    strDisplay = strDisplay & "Setting default value to 'no key' is '" & cPutRegistry(Section1, "", "no key") & "'" & vbCrLf
  135.    strDisplay = strDisplay & "Setting value of key 'key1' to 'test key 1' is '" & cPutRegistry(Section1, "key1", "test key 1") & "'" & vbCrLf
  136.    strDisplay = strDisplay & "Setting value of key 'key2' to 'test key 2' is '" & cPutRegistry(Section1, "key2", "test key 2") & "'" & vbCrLf & vbCrLf
  137.    strDisplay = strDisplay & "Getting default value is '" & cGetRegistry(Section1, "", "?") & "'" & vbCrLf
  138.    strDisplay = strDisplay & "Getting value of key 'key2' is '" & cGetRegistry(Section1, "key2", "?") & "'" & vbCrLf
  139.    strDisplay = strDisplay & "Getting value of key 'key1' is '" & cGetRegistry(Section1, "key1", "?") & "'" & vbCrLf & vbCrLf
  140.    strDisplay = strDisplay & "Key information is '" & cRegistryKeyInfo(Section1, RKI) & "'" & vbCrLf
  141.    strDisplay = strDisplay & "   SubKeys = " & RKI.lSubKeys & vbCrLf
  142.    strDisplay = strDisplay & "   MaxSubKeyLen = " & RKI.lMaxSubKeyLen & vbCrLf
  143.    strDisplay = strDisplay & "   Values = " & RKI.lValues & vbCrLf
  144.    strDisplay = strDisplay & "   MaxValueNameLen = " & RKI.lMaxValueNameLen & vbCrLf
  145.    strDisplay = strDisplay & "   MaxValueLen = " & RKI.lMaxValueLen & vbCrLf
  146.    strDisplay = strDisplay & "   InfoInStr = " & RKI.sInfoInStr & vbCrLf & vbCrLf
  147.    strDisplay = strDisplay & "Use section '" & Section2 & "'" & vbCrLf & vbCrLf
  148.    strDisplay = strDisplay & "Setting default value to 'License information' is '" & cPutRegistry(Section2, "", "License information") & "'" & vbCrLf
  149.    strDisplay = strDisplay & "Setting value of key 'Name' to 'James' is '" & cPutRegistry(Section2, "Name", "James") & "'" & vbCrLf
  150.    strDisplay = strDisplay & "Setting value of key 'Id' to 'Donb' is '" & cPutRegistry(Section2, "Id", "Donb") & "'" & vbCrLf
  151.    strDisplay = strDisplay & "Setting value of key 'N
  152. ' to '007' is '" & cPutRegistry(Section2, "N
  153. ", "007") & "'" & vbCrLf & vbCrLf
  154.    strDisplay = strDisplay & "Getting default value is '" & cGetRegistry(Section2, "", "?") & "'" & vbCrLf
  155.    strDisplay = strDisplay & "Getting value of key 'Name' is '" & cGetRegistry(Section2, "Name", "?") & "'" & vbCrLf
  156.    strDisplay = strDisplay & "Getting value of key 'Id' is '" & cGetRegistry(Section2, "Id", "?") & "'" & vbCrLf
  157.    strDisplay = strDisplay & "Getting value of key 'N
  158. ' is '" & cGetRegistry(Section2, "N
  159. ", "?") & "'" & vbCrLf & vbCrLf
  160.    strDisplay = strDisplay & "Key information is '" & cRegistryKeyInfo(Section2, RKI) & "'" & vbCrLf
  161.    strDisplay = strDisplay & "   SubKeys = " & RKI.lSubKeys & vbCrLf
  162.    strDisplay = strDisplay & "   MaxSubKeyLen = " & RKI.lMaxSubKeyLen & vbCrLf
  163.    strDisplay = strDisplay & "   Values = " & RKI.lValues & vbCrLf
  164.    strDisplay = strDisplay & "   MaxValueNameLen = " & RKI.lMaxValueNameLen & vbCrLf
  165.    strDisplay = strDisplay & "   MaxValueLen = " & RKI.lMaxValueLen & vbCrLf
  166.    strDisplay = strDisplay & "   InfoInStr = " & RKI.sInfoInStr & vbCrLf & vbCrLf
  167.    strDisplay = strDisplay & "Kill Section 'under the fox' is '" & cKillRegistry(Section1, "") & "'" & vbCrLf & vbCrLf
  168.    strDisplay = strDisplay & "Kill Section 'software\The MCR Company' is '" & cKillRegistry("software\The MCR Company", "") & "'" & vbCrLf & vbCrLf
  169.    strDisplay = strDisplay & "Kill Section 'software\The MCR Company\TIME TO WIN for VB 4.0' is '" & cKillRegistry("software\The MCR Company\TIME TO WIN for VB 4.0", "") & "'" & vbCrLf & vbCrLf
  170.    txt_Result = strDisplay
  171.    'time the function
  172.    intResult = cPutRegistry(Section2, "Name", "James")
  173.    TimerHandle = cTimerOpen()
  174.    TimerStartOk = cTimerStart(TimerHandle)
  175.    For i = 1 To Iteration
  176.       strResult = cGetRegistry(Section2, "", "?1")
  177.    Next i
  178.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  179.    TimerCloseOk = cTimerClose(TimerHandle)
  180.    intResult = cKillRegistry("software\The MCR Company", "")
  181. End Sub
  182. Private Sub TestRegistryExt()
  183.    Dim intResult        As Integer
  184.    Dim strResult        As String
  185.    Dim strDisplay       As String
  186.    Dim Section1         As String
  187.    Dim Section2         As String
  188.    Dim i                As Integer
  189.    strResult = ""
  190.    strDisplay = ""
  191.    strDisplay = strDisplay & "HKEY_LOCAL_MACHINE" & vbCrLf & vbCr